package jspSamples.unit7.websiteSample;


import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Test {
    public static void main(String[] args) {

        Connection conn = DBConnection.getConn();

        try {
            Statement statement = conn.createStatement();
            String sql = "select * from admin";
            ResultSet resultSet = statement.executeQuery(sql);
            while (resultSet.next()) {
                String username = resultSet.getString("AdminName");
                String password = resultSet.getString("AdminPwd");
                System.out.println(username + " " + password);
            }
            // 关闭数据库
            DBConnection.close(resultSet,statement,conn);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        // 关闭数据库连接


    }
}
